
import {Component} from 'react'

class Mouse extends Component{

    constructor(props){
        super(props);
        this.state={
            x:0,
            y:0
        }
    }

    handleMousemove=(e)=>{
       this.setState({
           x:e.clientX,
           y:e.clientY
       })
    }

     //界面挂在完毕的时候
    componentDidMount(){
      window.addEventListener("mousemove",this.handleMousemove);
    }
    
    componentWillUnmount(){
        window.removeEventListener("mousemove");  
    }

    render(){
      //return this.props.render(this.state);
      console.log(this.props.children,"****");
      return "111";
    }

}

export default Mouse;